#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
int is_leap_year(int y)
{
    if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0))
        return 1;
    else
        return 0;
}
int this_year_which_day(int y, int m, int d)
{
    int month_day[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if (is_leap_year(y) && m >= 2)
    {
        month_day[2] += 1;
    }
    int day_count = 0;
    int i = 0;
    for (i = 0; i < m; i++)
    {
        day_count += month_day[i];
    }
    return day_count += d;
}
int main()
{
    int year = 0;
    int month = 0;
    int day = 0;
    scanf("%d%d%d", &year, &month, &day);
    int days = this_year_which_day(year, month, day);
    printf("%d", days);
    return 0;
}